<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Tag extends Model
{
    //
    //关联表
    protected $table = 'tags';
    //主键
    public $primaryKey = 'id';
    //设置timesatmps为开启
    public $timestamps = true;

    public function posts()
    {
        return $this->belongsToMany('App\Post', 'post_tags');
    }
}
